package com.wzdigit.wms.basic.client.response;
/*
 * @Author:yangwenbiao
 * @Date 2020/6/8 9:59 AM
 * @version 1.0
 */


import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

public class Result<T> implements Serializable {
    //    private StatusCode code;//返回码
    @ApiModelProperty(value = "返回消息")
    private String message;//返回消息
    @ApiModelProperty(value = "成功标识")
    private boolean flag;//是否成功
    @ApiModelProperty(value = "返回数据")
    private T data;//返回数据
    @ApiModelProperty(value = "返回码，默认1")
    private Integer code;//返回码，默认1

    public Result(boolean flag, String message, Object data) {
        this.flag = flag;
        this.code = new Integer(1);//默认1
        this.message = message;
        this.data = (T) data;
    }

    public Result(boolean flag, String message) {
        this.code = new Integer(1);//默认1
        this.flag = flag;
        this.message = message;
    }

//    public Result(boolean flag, StatusCode code, String message) {
//        this.flag = flag;
//        this.code = code;
//        this.message = message;
//    }

    public Result() {
        this.flag = true;
//        this.code = StatusCode.OK;
        this.code = new Integer(1);//默认1
        this.message = "操作成功!";
    }
    
    public Result(Object data) {
        this.flag = true;
//        this.code = StatusCode.OK;
        this.code = new Integer(1);//默认1
        this.message = "操作成功!";
        this.data = (T) data;
    }

    public Result(String message, boolean flag, T data, Integer code) {
        this.message = message;
        this.flag = flag;
        this.data = data;
        this.code = code;
    }

    public boolean isFlag() {
        return flag;
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }

//    public StatusCode getCode() {
//        return code;
//    }

//    public void setCode(StatusCode code) {
//        this.code = code;
//    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
